import { Routes, Route } from 'react-router-dom'

import Home from '../views/main/home'
import Login from '../views/loign'

import { HomeRoutes, HomeRoutes2 } from './testRouter'
import { TestRouter } from './params'
import { PropsRouter } from './props'
import { UseStateRouter } from './useState1'
// 路由对应组件集中写这里
function RootRoute(): JSX.Element {
  return (
    <>
      {/* Routes  路由出口  路由对应的组件会在这里渲染*/}
      <Routes>
        {/* 默认展示 */}
        <Route path="/" element={<Home />}></Route>
        {/* Route 指定路径和组件对应关系   path 代表路径   element 代表组件 */}
        <Route path="/login" element={<Login />}></Route>
        {/* <Route path="*" element={<div>404</div>}></Route> */}
        {HomeRoutes2()}
        {TestRouter()}
        {PropsRouter()}
        {UseStateRouter()}
      </Routes>
      {/* useRoutes 数组写法 不能放在Routes里面 */}
      {HomeRoutes()}
    </>
  )
}

export default RootRoute
